{include file='header.tpl'}
{include file='admin/leftcol.tpl'}
<div id="left-area">
<div class="entry post clearfix width-for-all-img">
          <div class="breadcrumb">
            <span class="raquo"></span><a href="/">Главная</a>
           <span class="raquo"> &raquo; </span><a href="{geturl controller="admin" action="index"}">Админ панель</a>  
           <span class="raquo"> &raquo; </span><a href="{geturl controller='admin' action='categories'}">Категории</a>  
    </div> 
    <h1 class="category-title">Редактирование категории</h1> 
  
    <div class="form">
    <form method="post" action="{geturl route='editcategory' id=$fp->category->getId()}" id="editcategory-form">
        
       <div class="error"{if !$fp->hasError()} style="display: none"{/if}>
            Одно или несколько полей заполнены неверно. Проверьте, пожалуйста, 
            поля с ошибками и отправьте форму ещё раз.
        </div>
            
        <div class="row">
         <label for="form_name">Название:</label>
         <input type="text" id="form_name" name="name" value="{$fp->name|escape}" />
            <br> {include file='lib/error.tpl' error=$fp->getError('name')}
        </div>
        
        <div class="row">
         <label for="form_alias">ЧПУ (заполняеться не обязательно):</label>
         <input type="text" id="form_alias" name="alias" value="{$fp->alias|escape}" />
        </div>
        
        <div class="row">
         <label for="form_title">Meta-Title:</label>
         <input type="text" id="form_title" name="title" value="{$fp->title|escape}" />
        </div>
        
        <div class="row">
         <label for="form_descr">Meta-Description:</label>
         <input type="text" id="form_descr" name="descr" value="{$fp->descr|escape}" />
        </div>
        
        <div class="row">
         <label for="form_keywords">Meta-Keywords:</label>
         <input type="text" id="form_keywords" name="keywords" value="{$fp->keywords|escape}" />
        </div>
        
        <div class="row">
         <label for="form_content">Контент:</label>
         <textarea class="ckeditor"  id="form_content" name="content">{$fp->content|escape}</textarea>
        </div>
        
        <div class="row">
         <label for="form_name">Родительская категория:</label>
         <select name="parent_id" class="chosen-select">
             <option value="0">Каталог</option>
          {foreach from=$cats item='cat'}
             {if $cat->getId()==$fp->parent_id} 
            <option value='{$cat->getId()}' selected> {$cat->name|escape}</option>
            {else}
                <option value='{$cat->getId()}' > {$cat->name|escape}</option>
            {/if}
            {if $cat->child} 
                {foreach from=$cat->child item='ca'}
                 {if $ca->getId()==$fp->parent_id} 
                <option value='{$ca->getId()}' selected>{$cat->name|escape}-->{$ca->name|escape}</option>
                {else}
                    <option value='{$ca->getId()}' >{$cat->name|escape}-->{$ca->name|escape}</option>
                {/if}
                   {if $ca->child} 
                       {foreach from=$ca->child item='c'}
                        {if $c->getId()==$fp->parent_id} 
                <option value='{$c->getId()}' selected> {$cat->name|escape}-->{$ca->name|escape}-->{$c->name|escape}</option>
                       {else}
                    <option value='{$c->getId()}' >{$cat->name|escape}-->{$ca->name|escape}-->{$c->name|escape}</option>
                       {/if}
                                {if $c->child} 
                                {foreach from=$c->child item='c1'}
                                 {if $c1->getId()==$fp->parent_id} 
                         <option value='{$c1->getId()}' selected> {$cat->name|escape}-->{$ca->name|escape}-->{$c->name|escape}-->{$c1->name|escape}</option>
                                {else}
                             <option value='{$c1->getId()}' >{$cat->name|escape}-->{$ca->name|escape}-->{$c->name|escape}-->{$c1->name|escape}</option>
                                {/if}
                               {/foreach}
                           {/if}
                      {/foreach}
                  {/if}
              {/foreach}
            {/if}
          {/foreach}
        
         </select>
        </div>
      
        <div class="submit">
            <input type="submit" class="button green-pink" value="Добавить категорию" /></div>
    </form>
    </div>
</div> 

</div>
{include file="footer.tpl"}